#ifndef KMYTRANS_H
#define KMYTRANS_H

#include "KmyNode.h"

class KmyTrans : public KmyNode
{
public:
    KmyTrans(int screen_w, int screen_h);

    void finalize();

    const static int TRANS_TYPE_NONE = 0;   // 整体变黑
    const static int TRANS_TYPE_1 = 1;      // 大块平移
    const static int TRANS_TYPE_2 = 2;      // 卷帘
    const static int TRANS_TYPE_3 = 3;      // 方块
    const static int TRANS_TYPE_4 = 4;
    const static int TRANS_TYPE_5 = 5;
    const static int TRANS_TYPE_6 = 6;

    int trans_type;
    /**
      * 0 左
      * 1 右
      * 2 上
      * 3 下
      */
    int from; //方向

    int getNodeType();

    void logic();
    void render(KmyICanvas *screen);
    KmyITexture *tex;
    u16 *data16;

    int time;

    void startTrans(int type, int from, int time = 2000);
    void startRandomTrans(int time = 2000);

    void setColor(u16 rgba);

private:
    int width;
    int height;
    /**
      * 0 不画
      * 1 trans in
      * 2 盖满
      * 3 trans out
      */
    int step;
    int delay;

    int rect_num;
    St_Rect *rects;
};

#endif // KMYTRANS_H
